#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1010;
const int K = 25;
const int mod = 1e9+7;

ll f[K][N],fac[N],inv[N];
int n,k,a[K];

ll C(int x,int y){if(x < 0 || y < 0 || x < y) return 0; return fac[x] * inv[y] % mod * inv[x-y] % mod;}

ll qp(ll x,int t){ll res=1;for(;t;t>>=1,x=x*x%mod)if(t&1)res=res*x%mod;return res;}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,k = in;
	for(int i = 1;i <= k;i++) a[i] = in;
	for(int i = (fac[0] = 1);i <= n;i++) fac[i] = fac[i-1] * i % mod; inv[n] = qp(fac[n],mod-2);
	for(int i = n-1;i>=0;i--) inv[i] = inv[i+1] * (i+1) % mod;
	f[0][0] = 1;
	for(int i = 0;i < k;i++)
		for(int j = 0;j <= n;j++){
			if(!f[i][j]) continue;
			for(int t = 0;t <= a[i + 1] && t + j <= n;t++){
				f[i+1][j+t] = (f[i+1][j+t] + C(n-t,a[i+1]-t) * f[i][j] % mod * inv[t] % mod) % mod;
			}
		}
	printf("%lld\n",f[k][n] * fac[n] % mod);
	return 0;
}

